﻿using LPLS.DBEntities.ConfigModels.AlarmModels;
using LPLS.DBInterface.ConfigModels.AlarmModel;
using Prism.Common;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PLCAlarmRuleConfigModule.ViewModels
{
   public  class VariableCodeConfigViewModel:BindableBase
    {

        private IAlarmVarableCodeConfigService _alarmVarableCodeConfigService;

        public VariableCodeConfigViewModel(IAlarmVarableCodeConfigService alarmVarableCodeConfigService) {
        
        _alarmVarableCodeConfigService = alarmVarableCodeConfigService;

            AlarmVarCodeList = new ObservableCollection<AlarmVarableCodeConfig>();
            LoadData();
        }


        private ObservableCollection<AlarmVarableCodeConfig> _AlarmVarCodeList;

        public ObservableCollection<AlarmVarableCodeConfig> AlarmVarCodeList
        {
            get { return _AlarmVarCodeList; }
            set { SetProperty(ref _AlarmVarCodeList, value); }
        }


        private void LoadData() {
            AlarmVarCodeList.Clear();

            AlarmVarCodeList =new ObservableCollection<AlarmVarableCodeConfig>( _alarmVarableCodeConfigService.GetData());



        }





    }
}
